﻿using System;
using System.IO;
using System.Threading.Tasks;
using Fadada.FASC.SDK.DotNetCore.Enum;
using Fadada.FASC.SDK.DotNetCore.Interfaces;
using Fadada.FASC.SDK.DotNetCore.Model;
using Fadada.FASC.SDK.DotNetCore.Services;
using Fadada.FASC.SDK.DotNetCore.Utils;
using Newtonsoft.Json;

namespace Fadada.FASC.SDK.Console.Calling
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            System.Console.WriteLine("===========Fadada FASC 项目 控制台调用SDK样例===========\n\n\n");
            BaseInputInfo inputInfo = new BaseInputInfo();
            inputInfo.ReqDomainName = "https://uat-api.fadada.com/api/v5";
            inputInfo.APP_ID = "";
            inputInfo.APP_SECRET = "";
            string token = "61a84bd8569a4f039e6019d324f91ac2";
            while (true)
            {
                System.Console.WriteLine("===========选择菜单===========\n\n");
                System.Console.WriteLine("请输入《数字》进行菜单选择");
                System.Console.WriteLine("1获取token，\n2添加个人用户,\n3添加企业用户,\n4获取企业授权链接,\n5查询签署模板列表,\n6获取签署模板详情," +
                                         "\n7创建签署任务 (基于签署模板),\n8发起签署任务,\n9下载签署文件,\n10获取签署任务链接,\n11更新个人用户,\n" +
                                         "12删除个人用户,\n13禁用个人用户,\n14恢复个人用户,\n15获取个人用户授权链接,\n16查询个人用户基本信息," +
                                         "\n17获取个人用户身份信息,\n18查询个人用户实名认证进度,\n19解绑个人用户账号,\n21更新企业用户,\n22删除企业用户,\n23禁用企业用户,\n" +
                                         "24恢复企业用户,\n25查询企业用户基本信息,\n26获取企业用户身份信息,\n27查询企业用户实名认证进度,\n28申请添加企业成员," +
                                         "\n29查询企业成员状态,\n31获取企业管理链接,\n32解绑企业用户账号,\n41上传即时文件,\n42查询文档模板列表,\n43获取文档模板详情,\n44获取模板管理链接,\n" +
                                         "45构造企业用户授权链接,\n51创建签署任务,\n52添加签署任务文档,\n53移除签署任务文档,\n54添加签署任务控件,\n55移除签署任务控件," +
                                         "\n56获取签署任务控件设置链接,\n57填写签署任务控件内容,\n58添加签署任务附件,\n59移除签署任务附件,\n" +
                                         "60添加签署任务参与方,\n61移除签署任务参与方,\n62撤销签署任务,\n63定稿签署任务文档," +
                                         "\n64阻塞签署任务,\n65解阻签署任务,\n66结束签署任务,\n67获取签署任务详情,\n" +
                                         "68催办签署任务,\n71获取计费链接,\n其他选项退出,\n");
                int iChoice = Convert.ToInt32(System.Console.ReadLine());
                if (iChoice == 1)
                {
                    IGetAuthTokenService service = new GetAuthTokenService();
                    var result = await service.GetAuthTokenAsync(inputInfo);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));

                }
                else if (iChoice == 2)
                {
                    User user = new User();//用户信息
                    user.ClientUserId = "andykey1";
                    user.ClientUserName = "andyvalue1";
                    IGetBodyRespService<RespUserInfo, User> service = new GetBodyRespService<RespUserInfo, User>();
                    var result = await service.GetBodyRespAsync(user, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 3)
                {
                    Corp corp = new Corp(); //企业信息
                    corp.ClientCorpId = "andycorpkey1";
                    corp.ClientCorpName = "andycorpvalue1";

                    IGetBodyRespService<RespCorpInfo, Corp> service = new GetBodyRespService<RespCorpInfo, Corp>();
                    var result = await service.GetBodyRespAsync(corp, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 4)
                {
                    CorpAuthUrl corpAuthUrl = new CorpAuthUrl();  //企业获取注册URL信息
                    corpAuthUrl.OpenCorpId = "37f46184152a446793d9851e0ab732f7";//980fbc067c9345b4b0ec6b230ff398bf
                    corpAuthUrl.OperatorId = "88058c9aefd1496c95598bbff909d112";//0e5b9e6e76484bfdb09393681ba5804d
                    corpAuthUrl.CorpIdentInfoMatch = true;
                    corpAuthUrl.CorpIdentInfo = new CorpIdentInfo
                    {
                        CorpIdentNo = "1231",
                        CorpIdentType = "other"
                    };
                    corpAuthUrl.RequestAuthScope = new string[] { "ident_info", "signtask_init" };
                    IGetBodyRespService<RespCorpAuthUrlInfo, CorpAuthUrl> service = new GetBodyRespService<RespCorpAuthUrlInfo, CorpAuthUrl>();
                    var result = await service.GetBodyRespAsync(corpAuthUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 5)
                {
                    SignTemplateList signTemplateList = new SignTemplateList
                    {
                        ListPageNo = 1,
                        ListPageSize = 2
                    };
                    IGetBodyRespService<RespSignTemplateListInfo, SignTemplateList> service = new GetBodyRespService<RespSignTemplateListInfo, SignTemplateList>();
                    var result = await service.GetBodyRespAsync(signTemplateList, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 6)
                {
                    SignTemplateDetail signTemplateDetail = new SignTemplateDetail
                    {
                        SignTemplateId = "1635243428580177021"
                    };
                    IGetBodyRespService<RespSignTemplateDetailInfo, SignTemplateDetail> service = new GetBodyRespService<RespSignTemplateDetailInfo, SignTemplateDetail>();
                    var result = await service.GetBodyRespAsync(signTemplateDetail, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 7)
                {
                    SignTaskCreateTemplate signTaskCreateTemplate = new SignTaskCreateTemplate
                    {
                        SignTaskSubject = "andy 你好",
                        Initiator = new OpenId
                        {
                            IdType = "corp",
                            OpenCorpId = "9b4f259d66ec435daae51b2d6f8d8179"
                        },
                        SignTemplateId = "1635243428580177021",
                        FillActors = new FillActorTwo[1]//必填字段
                    };
                    signTaskCreateTemplate.FillActors[0] = new FillActorTwo
                    {
                        FillActor = new Actor
                        {
                            ActorType = "filler",
                            ActorId = "企业",
                            ActorIdentType = "corp",
                            Notification = new Notification
                            {
                                SendNotification = false
                            }
                        }
                    };
                    signTaskCreateTemplate.SignActors = new SignActorTwo[2];
                    signTaskCreateTemplate.SignActors[0] = new SignActorTwo
                    {
                        SignActor = new Actor
                        {
                            ActorType = "signer",
                            ActorId = "企业",
                            ActorIdentType = "corp",
                            Notification = new Notification
                            {
                                SendNotification = false
                            }
                        }
                    };
                    signTaskCreateTemplate.SignActors[1] = new SignActorTwo
                    {
                        SignActor = new Actor
                        {
                            ActorType = "signer",
                            ActorId = "个人",
                            ActorIdentType = "person",
                            Notification = new Notification
                            {
                                SendNotification = false
                            }
                        }
                    };
                    signTaskCreateTemplate.CcActors = new CCActor[1];
                    signTaskCreateTemplate.CcActors[0] = new CCActor
                    {
                        CcActor = new Actor
                        {
                            ActorType = "cc",
                            ActorId = "个人",
                            ActorIdentType = "person",
                            Notification = new Notification
                            {
                                SendNotification = false
                            }
                        }
                    };

                    IGetBodyRespService<RespSignTaskCreateTemplateInfo, SignTaskCreateTemplate> service = new GetBodyRespService<RespSignTaskCreateTemplateInfo, SignTaskCreateTemplate>();
                    var result = await service.GetBodyRespAsync(signTaskCreateTemplate, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 8)
                {
                    SignTaskInitiate signTaskInitiate = new SignTaskInitiate
                    {
                        SignTaskId = "1642145512386159305"//1642069079485193159
                    };
                    IGetBodyRespService<RespSignTaskInitiateInfo, SignTaskInitiate> service = new GetBodyRespService<RespSignTaskInitiateInfo, SignTaskInitiate>();
                    var result = await service.GetBodyRespAsync(signTaskInitiate, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 9)
                {
                    string strFilePath = @"E:\file\";
                    SignTaskDownloadFiles signTaskDownloadFiles = new SignTaskDownloadFiles
                    {
                        SignTaskId = "1640935237063137559"//1640935237063137559
                    };
                    ISignTaskDownloadFilesService service = new SignTaskDownloadFilesService();
                    var respResult = await service.GetSignTaskDownFilesAsync(signTaskDownloadFiles, inputInfo, token);
                    string strFileGuid = Guid.NewGuid().ToString();
                    if (respResult.ContentType.Contains("application/json"))
                    {
                        System.Console.WriteLine(JsonConvert.SerializeObject(new ResponseBodyInfo<RespDownloadInfo>
                        { Code = "40001", Msg = "没有找到文件" }));
                    }
                    else if (respResult.ContentType.Contains("application/zip"))
                    {
                        string strFileName = strFileGuid + ".zip";
                        bool bDownFlag = DownLoadFile.Download(respResult, strFilePath, strFileName);
                        if (!bDownFlag)
                        {
                            System.Console.WriteLine(JsonConvert.SerializeObject(new ResponseBodyInfo<RespDownloadInfo>
                            { Code = "40002", Msg = "下载文件失败" }));
                        }
                        else
                        {
                            System.Console.WriteLine(JsonConvert.SerializeObject(new ResponseBodyInfo<RespDownloadInfo>
                            { Code = "200", Msg = "下载文件成功" }));
                        }
                    }
                    else
                    {
                        string strFileName = strFileGuid + ".pdf";
                        bool bDownFlag = DownLoadFile.Download(respResult, strFilePath, strFileName);
                        if (!bDownFlag)
                        {
                            System.Console.WriteLine(JsonConvert.SerializeObject(new ResponseBodyInfo<RespDownloadInfo>
                            { Code = "40002", Msg = "下载文件失败" }));
                        }
                        else
                        {
                            System.Console.WriteLine(JsonConvert.SerializeObject(new ResponseBodyInfo<RespDownloadInfo>
                            { Code = "200", Msg = "下载文件成功" }));
                        }
                    }

                }
                else if (iChoice == 10)
                {
                    SignTaskGetUrl signTaskGetUrl = new SignTaskGetUrl
                    {
                        SignTaskId = "1642069079485193159",
                        ActorType = "filler",
                        ActorId = "企业",
                        RedirectUrl = "https://www.qq.com"
                    };
                    IGetBodyRespService<RespSignTaskGetUrlInfo, SignTaskGetUrl> service = new GetBodyRespService<RespSignTaskGetUrlInfo, SignTaskGetUrl>();
                    var result = await service.GetBodyRespAsync(signTaskGetUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 11)
                {
                    UserUpdate userUpdate = new UserUpdate
                    {
                        OpenUserId = "0e5b9e6e76484bfdb09393681ba5804d",
                        ClientUserId = "andykey1",
                        ClientUserName = "andyvalue1"
                    };
                    IGetBodyRespService<RespUserUpdateInfo, UserUpdate> service = new GetBodyRespService<RespUserUpdateInfo, UserUpdate>();
                    var result = await service.GetBodyRespAsync(userUpdate, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 12)
                {
                    UserDelete userDelete = new UserDelete
                    {
                        OpenUserId = "0e5b9e6e76484bfdb09393681ba5804d"
                    };
                    IGetBodyRespService<RespUserDeleteInfo, UserDelete> service = new GetBodyRespService<RespUserDeleteInfo, UserDelete>();
                    var result = await service.GetBodyRespAsync(userDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 13)
                {
                    UserDisable userDisable = new UserDisable
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112"
                    };
                    IGetBodyRespService<RespUserDisableInfo, UserDisable> service = new GetBodyRespService<RespUserDisableInfo, UserDisable>();
                    var result = await service.GetBodyRespAsync(userDisable, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 14)
                {
                    UserEnable userEnable = new UserEnable
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112"
                    };
                    IGetBodyRespService<RespUserEnableInfo, UserEnable> service = new GetBodyRespService<RespUserEnableInfo, UserEnable>();
                    var result = await service.GetBodyRespAsync(userEnable, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 15)
                {
                    UserGetAuthUrl userGetAuthUrl = new UserGetAuthUrl
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112",
                        RequestAuthScope = new string[] { "ident_info", "signtask_init" }
                    };
                    IGetBodyRespService<RespUserGetAuthUrlInfo, UserGetAuthUrl> service = new GetBodyRespService<RespUserGetAuthUrlInfo, UserGetAuthUrl>();
                    var result = await service.GetBodyRespAsync(userGetAuthUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 16)
                {
                    UserGet userGet = new UserGet
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112"
                    };
                    IGetBodyRespService<RespUserGetInfo, UserGet> service = new GetBodyRespService<RespUserGetInfo, UserGet>();
                    var result = await service.GetBodyRespAsync(userGet, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 17)
                {
                    UserGetIdentityInfo userGetIdentityInfo = new UserGetIdentityInfo
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112"
                    };
                    IGetBodyRespService<RespUserGetIdentityInfo, UserGetIdentityInfo> service = new GetBodyRespService<RespUserGetIdentityInfo, UserGetIdentityInfo>();
                    var result = await service.GetBodyRespAsync(userGetIdentityInfo, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 19)
                {
                    UserUnbind userUnbind = new UserUnbind
                    {
                        OpenUserId = "88058c9aefd1496c95598bbff909d112"
                    };
                    IGetBodyRespService<RespUserUnbindInfo, UserUnbind> service = new GetBodyRespService<RespUserUnbindInfo, UserUnbind>();
                    var result = await service.GetBodyRespAsync(userUnbind, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 21)
                {
                    CorpUpdate corpUpdate = new CorpUpdate
                    {
                        OpenCorpId = "980fbc067c9345b4b0ec6b230ff398bf",
                        ClientCorpId = "andycorpkey1",
                        ClientCorpName = "andycorpvalue1"
                    };

                    IGetBodyRespService<RespCorpUpdateInfo, CorpUpdate> service = new GetBodyRespService<RespCorpUpdateInfo, CorpUpdate>();
                    var result = await service.GetBodyRespAsync(corpUpdate, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 22)
                {
                    CorpDelete corpDelete = new CorpDelete
                    {
                        OpenCorpId = "980fbc067c9345b4b0ec6b230ff398bf"
                    };

                    IGetBodyRespService<RespCorpDeleteInfo, CorpDelete> service = new GetBodyRespService<RespCorpDeleteInfo, CorpDelete>();
                    var result = await service.GetBodyRespAsync(corpDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 23)
                {
                    CorpDisable corpDisable = new CorpDisable()
                    {
                        OpenCorpId = "37f46184152a446793d9851e0ab732f7"
                    };

                    IGetBodyRespService<RespCorpDisableInfo, CorpDisable> service = new GetBodyRespService<RespCorpDisableInfo, CorpDisable>();
                    var result = await service.GetBodyRespAsync(corpDisable, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 24)
                {
                    CorpEnable corpEnable = new CorpEnable()
                    {
                        OpenCorpId = "37f46184152a446793d9851e0ab732f7"
                    };

                    IGetBodyRespService<RespCorpEnableInfo, CorpEnable> service = new GetBodyRespService<RespCorpEnableInfo, CorpEnable>();
                    var result = await service.GetBodyRespAsync(corpEnable, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 25)
                {
                    CorpGet corpGet = new CorpGet()
                    {
                        OpenCorpId = "37f46184152a446793d9851e0ab732f7"
                    };

                    IGetBodyRespService<RespCorpGetInfo, CorpGet> service = new GetBodyRespService<RespCorpGetInfo, CorpGet>();
                    var result = await service.GetBodyRespAsync(corpGet, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 26)
                {
                    CorpGetIdentityInfo corpGetIdentityInfo = new CorpGetIdentityInfo
                    {
                        OpenCorpId = "f3b355c0665a4010a96f0e6823411cbe"
                    };

                    IGetBodyRespService<RespCorpGetIdentityInfo, CorpGetIdentityInfo> service = new GetBodyRespService<RespCorpGetIdentityInfo, CorpGetIdentityInfo>();
                    var result = await service.GetBodyRespAsync(corpGetIdentityInfo, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }

                else if (iChoice == 31)
                {
                    ManageGetManageUrl manageGetManageUrl = new ManageGetManageUrl
                    {
                        OpenCorpId = "115c0c0d70064b75a5a1ce1435d56578",
                        OperatorId = "8a3cb72ef85f4f62a6e82935eb41908c",
                        ResourceId = "seal"
                    };

                    IGetBodyRespService<RespManageGetManageUrlInfo, ManageGetManageUrl> service = new GetBodyRespService<RespManageGetManageUrlInfo, ManageGetManageUrl>();
                    var result = await service.GetBodyRespAsync(manageGetManageUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 32)
                {
                    CorpUnbind corpUnbind = new CorpUnbind
                    {
                        OpenCorpId = "f3b355c0665a4010a96f0e6823411cbe"
                    };
                    IGetBodyRespService<RespCorpUnbindInfo, CorpUnbind> service = new GetBodyRespService<RespCorpUnbindInfo, CorpUnbind>();
                    var result = await service.GetBodyRespAsync(corpUnbind, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 41)
                {
                    var fileContent = new FileItem(@"I:\aa.doc");
                    FileUploadInstant fileUploadInstant = new FileUploadInstant
                    {
                        OwnerId = new OpenId()
                        {
                            IdType = "person",
                            OpenUserId = "a1d21b1ddbfa496dbf6cdab2c854e6a0"//8a3cb72ef85f4f62a6e82935eb41908c
                        },
                        FileType = "attach",
                        FileName = "aa.doc",
                        FileContentHash = CryptTool.HashDataString(fileContent.Stream, "sha256").ToLower()
                    };

                    IGetUploadFileService<RespFileUploadInstantInfo, FileUploadInstant> service = new GetUploadFileService<RespFileUploadInstantInfo, FileUploadInstant>();
                    var result = await service.UploadFileAsync(fileUploadInstant, inputInfo, fileContent, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 42)
                {
                    DocTemplateGetList docTemplateGetList = new DocTemplateGetList
                    {
                        //OwnerId = new OpenId()
                        //{
                        //    IdType = "person",
                        //    OpenUserId = "8a3cb72ef85f4f62a6e82935eb41908c"
                        //}
                    };
                    IGetBodyRespService<RespDocTemplateGetListInfo, DocTemplateGetList> service = new GetBodyRespService<RespDocTemplateGetListInfo, DocTemplateGetList>();
                    var result = await service.GetBodyRespAsync(docTemplateGetList, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 43)
                {
                    DocTemplateGetDetail docTemplateGetDetail = new DocTemplateGetDetail
                    {
                        DocTemplateId = "1635755968000131405"
                    };
                    IGetBodyRespService<RespDocTemplateGetDetailInfo, DocTemplateGetDetail> service = new GetBodyRespService<RespDocTemplateGetDetailInfo, DocTemplateGetDetail>();
                    var result = await service.GetBodyRespAsync(docTemplateGetDetail, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 51)
                {
                    SignTaskCreate signTaskCreate = new SignTaskCreate
                    {
                        SignTaskSubject = "hello 冬奥",
                        Initiator = new OpenId
                        {
                            IdType = "person",
                            OpenUserId = "8a3cb72ef85f4f62a6e82935eb41908c"
                        },
                        AutoFillFinalize = false

                    };
                    IGetBodyRespService<RespSignTaskCreateInfo, SignTaskCreate> service = new GetBodyRespService<RespSignTaskCreateInfo, SignTaskCreate>();
                    var result = await service.GetBodyRespAsync(signTaskCreate, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 52)
                {
                    SignTaskDocAdd signTaskDocAdd = new SignTaskDocAdd
                    {
                        SignTaskId = "1644393336261139698",
                        Docs = new[]
                        {
                            new Doc
                            {
                                DocId = 2,
                                DocName = "张家口",
                                DocTemplateId = "1635755968000131405"
                            }
                        }
                    };
                    IGetBodyRespService<RespSignTaskDocAddInfo, SignTaskDocAdd> service = new GetBodyRespService<RespSignTaskDocAddInfo, SignTaskDocAdd>();
                    var result = await service.GetBodyRespAsync(signTaskDocAdd, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 53)
                {
                    SignTaskDocDelete signTaskDocDelete = new SignTaskDocDelete()
                    {
                        SignTaskId = "1644393336261139698",
                        DocIds = new int[] { 1 }
                    };
                    IGetBodyRespService<RespSignTaskDocDeleteInfo, SignTaskDocDelete> service = new GetBodyRespService<RespSignTaskDocDeleteInfo, SignTaskDocDelete>();
                    var result = await service.GetBodyRespAsync(signTaskDocDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 54)
                {
                    SignTaskFieldAdd signTaskFieldAdd = new SignTaskFieldAdd
                    {
                        SignTaskId = "1644393336261139698",
                        Fields = new Fields[]
                        {
                            new Fields
                            {
                                DocId = 3,
                                DocFields = new []
                                {
                                    new Field
                                    {
                                        FieldId = "002",
                                        FieldName = "文本输入框",
                                        Position = new FieldPosition
                                        {
                                            PositionMode = "pixel",
                                            PositionPageNo = 1,
                                            PositionX = "2",
                                            PositionY = "1"
                                        },
                                        FieldType = "corp_seal"
                                    }
                                }
                            }
                        },
                    };
                    IGetBodyRespService<RespSignTaskFieldAddInfo, SignTaskFieldAdd> service = new GetBodyRespService<RespSignTaskFieldAddInfo, SignTaskFieldAdd>();
                    var result = await service.GetBodyRespAsync(signTaskFieldAdd, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 55)
                {
                    SignTaskFieldDelete signTaskFieldDelete = new SignTaskFieldDelete()
                    {
                        SignTaskId = "1644393336261139698",
                        Fields = new FieldsTwo[]
                        {
                            new FieldsTwo
                            {
                                DocId = 3,
                                FieldIds = new string[] { "002" }
                            }
                        }
                    };
                    IGetBodyRespService<RespSignTaskFieldDeleteInfo, SignTaskFieldDelete> service = new GetBodyRespService<RespSignTaskFieldDeleteInfo, SignTaskFieldDelete>();
                    var result = await service.GetBodyRespAsync(signTaskFieldDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 56)
                {
                    SignTaskFieldGetUrl signTaskFieldGetUrl = new SignTaskFieldGetUrl
                    {
                        SignTaskId = "1644393336261139698",
                        OpenUserId = "8a3cb72ef85f4f62a6e82935eb41908c"
                    };
                    IGetBodyRespService<RespSignTaskFieldGetUrlInfo, SignTaskFieldGetUrl> service = new GetBodyRespService<RespSignTaskFieldGetUrlInfo, SignTaskFieldGetUrl>();
                    var result = await service.GetBodyRespAsync(signTaskFieldGetUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 57)
                {
                    SignTaskFieldFillValues signTaskFieldFillValues = new SignTaskFieldFillValues
                    {
                        SignTaskId = "1654072758998174911",//1644393336261139698  ceshi/1644903847541180130
                        DocFieldValues = new DocFieldValue[]
                        {
                            new DocFieldValue
                            {
                                DocId = 0,
                                FieldId = "5708168211",
                                FieldValue = "第2次 接口填充1%"
                            },
                            new DocFieldValue
                            {
                                DocId = 0,
                                FieldId = "7484762194",
                                FieldValue = "第2次 接口填充2 ~!@#$%^&*()"
                            },
                            new DocFieldValue
                            {
                                DocId = 0,
                                FieldId = "9883265763",
                                FieldValue = "第2次 接口填充3 ~!@#$$^&*()"
                            },
                        }
                    };
                    IGetBodyRespService<RespSignTaskFieldFillValuesInfo, SignTaskFieldFillValues> service = new GetBodyRespService<RespSignTaskFieldFillValuesInfo, SignTaskFieldFillValues>();
                    var result = await service.GetBodyRespAsync(signTaskFieldFillValues, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 58) //  添加签署任务附件
                {
                    SignTaskAttachAdd signTaskAttachAdd = new SignTaskAttachAdd
                    {
                        SignTaskId = "1644903847541180130",//
                        Attachs = new Attach[]
                        {
                            new Attach
                            {
                                AttachId = 1,
                                AttachName = "hi nova9",
                                AttachFileId = "1646206220985120999"//"1644895165995143642"
                            }
                        }
                    };
                    IGetBodyRespService<RespSignTaskAttachAddInfo, SignTaskAttachAdd> service = new GetBodyRespService<RespSignTaskAttachAddInfo, SignTaskAttachAdd>();
                    var result = await service.GetBodyRespAsync(signTaskAttachAdd, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 59) // 移除签署任务附件
                {
                    SignTaskAttachDelete signTaskAttachDelete = new SignTaskAttachDelete
                    {
                        SignTaskId = "1644903847541180130",
                        AttachIds = new[] { 1 }

                    };
                    IGetBodyRespService<RespSignTaskAttachDeleteInfo, SignTaskAttachDelete> service = new GetBodyRespService<RespSignTaskAttachDeleteInfo, SignTaskAttachDelete>();
                    var result = await service.GetBodyRespAsync(signTaskAttachDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 60)
                {
                    SignTaskActorAdd signTaskActorAdd = new SignTaskActorAdd
                    {
                        SignTaskId = "1645581657578114293",
                        //SignActors = new []
                        //{
                        //    new SignActorFour
                        //    {
                        //        SignActor = new Actor
                        //        {
                        //            ActorType = "signer",
                        //            ActorId = "个人",
                        //            ActorIdentType = "person",
                        //            Notification = new Notification
                        //            {
                        //                SendNotification = false
                        //            }
                        //        }
                        //    }
                        //},
                        CcActors = new CCActor[]
                        {
                            new CCActor
                            {
                                CcActor = new Actor
                                {
                                    ActorType = "cc",
                                    ActorId = "个人",
                                    ActorIdentType = "person",
                                    Notification = new Notification
                                    {
                                        SendNotification = false
                                    }
                                }
                            }
                        }
                    };
                    IGetBodyRespService<RespSignTaskActorAddInfo, SignTaskActorAdd> service = new GetBodyRespService<RespSignTaskActorAddInfo, SignTaskActorAdd>();
                    var result = await service.GetBodyRespAsync(signTaskActorAdd, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 61)
                {
                    SignTaskActorDelete signTaskActorDelete = new SignTaskActorDelete
                    {
                        SignTaskId = "1644393336261139698",
                        ActorType = "cc",
                        ActorIds = new[] { "个人" }
                    };
                    IGetBodyRespService<RespSignTaskActorDeleteInfo, SignTaskActorDelete> service = new GetBodyRespService<RespSignTaskActorDeleteInfo, SignTaskActorDelete>();
                    var result = await service.GetBodyRespAsync(signTaskActorDelete, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 62)
                {
                    SignTaskCancel signTaskCancel = new SignTaskCancel
                    {
                        SignTaskId = "1642145512386159305"
                    };
                    IGetBodyRespService<RespSignTaskCancelInfo, SignTaskCancel> service = new GetBodyRespService<RespSignTaskCancelInfo, SignTaskCancel>();
                    var result = await service.GetBodyRespAsync(signTaskCancel, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 63)//定稿签署任务文档
                {
                    SignTaskDocFinalize signTaskDocFinalize = new SignTaskDocFinalize
                    {
                        SignTaskId = "1646285603777166059"//1646211712215172860     1642142488482162325
                    };
                    IGetBodyRespService<RespSignTaskDocFinalizeInfo, SignTaskDocFinalize> service = new GetBodyRespService<RespSignTaskDocFinalizeInfo, SignTaskDocFinalize>();
                    var result = await service.GetBodyRespAsync(signTaskDocFinalize, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 64)// 阻塞签署任务
                {
                    SignTaskBlock signTaskBlock = new SignTaskBlock
                    {
                        SignTaskId = "1644903847541180130",
                        ActorType = "signer",
                        ActorId = "个人"
                    };
                    IGetBodyRespService<RespSignTaskBlockInfo, SignTaskBlock> service = new GetBodyRespService<RespSignTaskBlockInfo, SignTaskBlock>();
                    var result = await service.GetBodyRespAsync(signTaskBlock, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 65)// 解阻签署任务
                {
                    SignTaskUnblock signTaskUnBlock = new SignTaskUnblock
                    {
                        SignTaskId = "1644903847541180130",
                        ActorType = "signer",
                        ActorId = "个人"
                    };
                    IGetBodyRespService<RespSignTaskUnblockInfo, SignTaskUnblock> service = new GetBodyRespService<RespSignTaskUnblockInfo, SignTaskUnblock>();
                    var result = await service.GetBodyRespAsync(signTaskUnBlock, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 66)// 结束签署任务
                {
                    SignTaskFinish signTaskFinish = new SignTaskFinish
                    {
                        SignTaskId = "1646285603777166059"
                    };
                    IGetBodyRespService<RespSignTaskFinishInfo, SignTaskFinish> service = new GetBodyRespService<RespSignTaskFinishInfo, SignTaskFinish>();
                    var result = await service.GetBodyRespAsync(signTaskFinish, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 67)
                {
                    SignTaskGetDetail signTaskGetDetail = new SignTaskGetDetail
                    {
                        SignTaskId = "1644393336261139698"
                    };
                    IGetBodyRespService<RespSignTaskGetDetailInfo, SignTaskGetDetail> service = new GetBodyRespService<RespSignTaskGetDetailInfo, SignTaskGetDetail>();
                    var result = await service.GetBodyRespAsync(signTaskGetDetail, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 68)// 催办签署任务
                {
                    SignTaskUrgeSign signTaskUrgeSign = new SignTaskUrgeSign
                    {
                        SignTaskId = "1644551524323139545"
                    };
                    IGetBodyRespService<RespSignTaskUrgeSignInfo, SignTaskUrgeSign> service = new GetBodyRespService<RespSignTaskUrgeSignInfo, SignTaskUrgeSign>();
                    var result = await service.GetBodyRespAsync(signTaskUrgeSign, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 44)//获取模板管理链接
                {
                    TemplateGetPageManageUrl templateGetPageManageUrl = new TemplateGetPageManageUrl
                    {
                        OpenCorpId = "f3b355c0665a4010a96f0e6823411cbe"
                    };
                    IGetBodyRespService<RespTemplateGetPageManageUrlInfo, TemplateGetPageManageUrl> service = new GetBodyRespService<RespTemplateGetPageManageUrlInfo, TemplateGetPageManageUrl>();
                    var result = await service.GetBodyRespAsync(templateGetPageManageUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else if (iChoice == 45)
                {
                    CorpAuthUrlInfo corpAuthUrlInfo = new CorpAuthUrlInfo
                    {
                        OpenCorpId = "9b4f259d66ec435daae51b2d6f8d8179",
                        CorpName = "深圳法大大",
                        AuthScopes = "ident_info,signtask_init,resource_for_sign",
                        RedirectUrl = "http://www.baidu.com"
                    };
                    IConstructiveCorpAuthUrl service = new ConstructiveCorpAuthUrl();
                    var result = await service.GetCorpAuthUrlAsync(inputInfo, corpAuthUrlInfo, CorpAuthDomainUrlEnum.Pro);
                    System.Console.WriteLine(result);
                }
                else if (iChoice == 71)
                {
                    BillingGetBillUrl billingGetBillUrl = new BillingGetBillUrl
                    {
                        OpenId = new OpenId
                        {
                            IdType = "person",
                            OpenUserId = "a1d21b1ddbfa496dbf6cdab2c854e6a0"
                        }
                    };
                    IGetBodyRespService<RespBillingGetBillUrlInfo, BillingGetBillUrl> service = new GetBodyRespService<RespBillingGetBillUrlInfo, BillingGetBillUrl>();
                    var result = await service.GetBodyRespAsync(billingGetBillUrl, inputInfo, token);
                    System.Console.WriteLine(JsonConvert.SerializeObject(result));
                }
                else
                {
                    System.Console.WriteLine("===========退出菜单===========\n\n");
                    break;
                }
            }

        }
    }
}
